var form = document.getElementById('newUser');

form.onsubmit = function(e) {
	e.preventDefault();
	var newUserData = {};
	for ( var i = 0, ii = form.length; i < ii; ++i) {
		var input = form[i];
		if(input.name){
			newUserData[input.name] = input.value;
		}
	}
	
	var user = JSON.stringify(newUserData);

	$.ajax({
		type : 'POST',
		url : $("#newUser").attr('action'),
		data : user,
		success : function(msg) {
			document.write(msg);
		}
	});
}